package com.zzx.controller;

/**
 * @Author: zzx
 * @Date: 2025/5/21 22:53
 */

import com.alibaba.fastjson.JSONObject;
import com.zzx.entity.ApiResult;
import com.zzx.entity.vo.DecryptUserInfo;
import com.zzx.service.TUserService;
import com.zzx.system.service.ISysUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@Api(tags = "认证接口")
@RestController
@RequestMapping("/auth")
public class AuthController {

    @Autowired
    private ISysUserService tWxUserService;

    @ApiOperation("微信登录")
    @PostMapping("/wxLogin")
    public ApiResult wxLogin(@RequestBody JSONObject param) {
        JSONObject res = tWxUserService.wxLogin(param.getString("code"));
        return ApiResult.ok(res);
    }

    @ApiOperation("解析UserInfo")
    @PostMapping("/decryptUserInfo")
    public ApiResult decryptUserInfo(@RequestBody DecryptUserInfo decryptUserInfo) {
        JSONObject res = tWxUserService.decryptUserInfo(decryptUserInfo);
        return ApiResult.ok(res);
    }
}
